package com.itheima.service.oss;

import com.itheima.autoconfig.template.OssTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@Service
public class OssService {

    @Autowired
    private OssTemplate ossTemplate;

    public String ossUpload(MultipartFile photoFile) throws IOException {

        String url = ossTemplate.upload(photoFile.getOriginalFilename(), photoFile.getInputStream());
        return url;
    }
}
